#include "Font.h"
#include <string>
Font::Font(ID3D11Device* device,ID3D11DeviceContext* context)
{
	m_font = std::make_unique<SpriteFont>(device, L"myfile.spritefont");
	m_spriteBatch = std::make_unique<SpriteBatch>(context);
}

void Font::BeginFontRender()
{
	m_spriteBatch->Begin();
}

void Font::Draw(std::string output, Color color,Vector2 pos)
{
	Vector2 origin = m_font->MeasureString(output.c_str()) / 2.f;
	m_font->DrawString(m_spriteBatch.get(), output.c_str(),
		pos, color, 0.f, {});
}

void Font::EndFontRender()
{
	m_spriteBatch->End();
}

void Font::Reset()
{
	m_spriteBatch.reset();
}
